CC=gcc
CFLAGS=-W -Wall -g -pthread
EXEC=tracker
TEST=client

all: $(EXEC) 

$(EXEC): daemon.o process.o network.o request.o database.o
	$(CC) $(CFLAGS) $^ -o $@ 
	$(CC) $(CFLAGS) client_only_for_tests.c -o client

$(TEST): client_only_for_test.o
	$(CC) $(CFLAGS) $^ -o $@ 

daemon.o: daemon.c
	$(CC) $(CFLAGS) -c $< -o $@ 

process.o: process.c process.h
	$(CC) $(CFLAGS) -c $< -o $@

network.o: network.c network.h
	$(CC) $(CFLAGS) -c $< -o $@
	
request.o: request.c request.h
	$(CC) $(CFLAGS) -c $< -o $@
	
database.o: database.c database.h
	$(CC) $(CFLAGS) -c $< -o $@	

client_only_for_test.o: client_only_for_test.c
	$(CC) $(CFLAGS) -c $< -o $@ 
	
clean:
	rm -f *.o
	rm -f $(EXEC)
	rm -f client
	rm -f *~
